<template>
  <a-form-item :name="props.formNamePath" :label="formItem.label" :rules="[formItem.rule]" :extra="formItem.extra"
    :style="{ marginLeft: formItem.marginLeft + 'px' }"
    :class="formItem.associated ? 'form-a-radio-group_associated' : 'form-a-number-input'">
    <div class="text-content">
      <!-- <i class="iconfont icon-Add"></i> -->
      <a-input :disabled="formItem.disabled" class="text" v-model:value="formItem.value"
        :placeholder="formItem.placeholder"></a-input>
    </div>
    <div class="help-msg" v-if="formItem.helpMsg">
      {{ formItem.helpMsg }}
    </div>
  </a-form-item>
</template>

<script lang="ts" setup>
import { ref, reactive, watch, computed } from "vue"
import { dataSourceType } from "@/type.d";
import { useColumnItem } from '@/components/draggable/hooks/useColumnModel';
const emit = defineEmits(['changeName'])
//props
const props = defineProps({
  formItem: {
    type: Object,
    default: {} as dataSourceType
  },
  formNamePath: []
})
let formItem: any = ref(props.formItem as any);
useColumnItem(computed(() => props.formItem), formItem)

const changeName = (e: any) => {
  formItem.value = e.target.value;
  emit('changeName', formItem.value)
};

</script>

<style lang="less" scoped>
.help-msg {
  margin-top: 8px;
  font-size: 12px;
  font-family: PingFang SC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.45);
  line-height: 20px;
}

.text-content {
  width: 100%;
  height: 32px;
  border-radius: 2px;
  opacity: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;

  .icon-Add {
    width: 20px;
    height: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }

  .icon-Add::before {
    height: 24px;
  }

  .text {
    font-size: 14px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.85);
    line-height: 14px;
  }
}
</style>